<!DOCTYPE html>
<html lang="zh_CN">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>设置类型</title>
	<meta name="viewport" content="initial-scale=1, maximum-scale=1">
	<!-- <link rel="shortcut icon" href="http://favicon.ico"> -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="viewport"
		content="width=device-width, height=device-height, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">

	<!-- 固定的css 和 common.js 的引用    -->
	<link rel="stylesheet" href="http://47.104.254.28/commonfile/css/sm.min.css">
	<link rel="stylesheet" href="http://47.104.254.28/commonfile/css/common.css">
	<script type="text/javascript"
		src="http://47.104.254.28/commonfile/common/common/common.js"></script>

	<!-- <link rel="stylesheet" href="../../css/sm.min.css">
	<link rel="stylesheet" href="../../css/common.css"> -->
	<!-- <script type="text/javascript" src="../../common/common/common.js"></script> -->

	<!-- <script type="text/javascript"
		src="http://47.104.254.28/commonfile/js/js/vconsole.min.js"></script>
	<script>
		var vConsole = new VConsole();
	</script> -->



	<style type="text/css">
		body, .page {
			background: #fff;
    }
    
    .container {
      box-sizing: border-box;
      padding: 0 1rem;
    }

		.nav-box {
      width: 100%;
			padding: 0.75rem 0;
    }
    
    .nav-wrap {
      box-sizing: border-box;
      width: 100%;
			height: 5.15rem;
    }

		.nav-wrap .text {
			text-align: center;
			line-height: 5.15rem;
		}

		.list-box {
			box-sizing: border-box;
		}

		.list-box .list {
			box-sizing: border-box;
			padding-bottom: 0.8rem;
		}

		.list-box .list .list-item {
			box-sizing: border-box;
			width: 100%;
			padding: 0 1rem;
			text-align: center;
			font-size: 0.75rem;
			border-radius: 2rem;
			line-height: 2rem;
			overflow: hidden;
			text-overflow:ellipsis;
			white-space: nowrap;
			background: #f8f8f8;
		}
	</style>


</head>

<body>
	<div class="page-group">
		<div class="page page-current">
			<div class="container">
				<div class="nav-box">
					<!-- <div class="nav-wrap">
						<div class="text">你要参加什么考试？</div>
					</div> -->
				</div>

				<div class="list-box">
					<!-- <div class="list">
						<div class="list-item">成人高考(高中起点升本科、专科)</div>
					</div> -->
				</div>
			</div>
		</div>
	</div>




	<!-- 固定的js引用，所有的jQuery 要用 $$ 表示 -->
	<script type="text/javascript"
		src="http://47.104.254.28/commonfile/js/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript">var $$ = jQuery.noConflict();</script>
	<script type='text/javascript'
		src='http://47.104.254.28/commonfile/zepto/zepto/zepto.min.js' charset='utf-8'></script>
	<script type='text/javascript' src='http://47.104.254.28/commonfile/js/js/sm.min.js'
		charset='utf-8'></script>

	<!-- <script type="text/javascript"
		src="../../js/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript">var $$ = jQuery.noConflict();</script>
	<script type='text/javascript'
		src='../../zepto/zepto/zepto.min.js' charset='utf-8'></script>
	<script type='text/javascript' src='../../js/js/sm.min.js'
		charset='utf-8'></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.7/js/swiper.min.js"></script> -->

	<!-- <script type='text/javascript' src='http://47.104.254.28/commonfile/js/js/sm-extend.min.js' charset='utf-8'></script> -->
	<!-- <script src="http://47.104.254.28/commonfile/js/js/swiper/swiper.min.js"></script> -->

	<script type="text/javascript">
		var books = {};
		var values = {};
		function successCallBack(data) {
			if (!data.success) {
				$.toast(data.message, 1500);
			}
			if (isNotNull(data.data)) {
				let list = data.data;
				let html = ''
				for (let val of list) {
					html += `<div class="list">
						<div data-id="${val.id}" data-key="${val.key}" class="list-item">${ val.value }</div>
					</div>`
				}
				$('.list-box').html(html);
				$$('.list-item').on('click', function() {
					values = {
						value: $$(this).text(),
						key: $$(this).data('key'),
						type:"setType"
					}
					getParamsBook(values);

					//发送value到本地,通知本地开始倒计时
				});
			}
		}

		function errorCallBack(data) {
			cosnole.log(data)
		}

		function getParams(data) {
			//	data需要转成json调用 ，函数urlParamParseJson();
			var jsonData = urlParamParseJson(data);
			var params = {
			}
		
			net_request('get', '/api/v1/dicts?type=book_type', params, successCallBack, errorCallBack);
		}

		function successCallBackBook(data) {
			if (isNotNull(data.data)) {
				if (data.data.length > 0) {
					let list = data.data;
					books = list[0];
					var bookValues = {
						key1: books.id,
						value2: books.book_name,
						key: values.key,
						value: values.value,
						type:"setType"
					}
					send_data(bookValues);
				}
			
			}
		}

		function errorCallBackBook(data) {
			console.log(data)
		}
		
		function getParamsBook(data) {
			//	data需要转成json调用 ，函数urlParamParseJson();
			var params = {
				offset: 0,
				limit: 50,
				book_price: '',
				book_type: data.key,
				book_value: data.value
			}

			net_request('get', 'api/v1/books', params, successCallBackBook, errorCallBackBook);
		}
		$$(function () {
			getParams();
			$.init();
		});

	</script>
</body>

</html>